#ifndef DYNAMICQOBJECT_H
#define DYNAMICQOBJECT_H

#include <QObject>
#include <QHash>
#include <QByteArray>
#include <QVector>
#include "sh_global.h"

class SHSHARED_EXPORT DynamicQObject : public QObject
{
public:
    DynamicQObject(QObject *mapToObject,
                   const char *signalCatchMethod,
                   QObject *parent = 0);

    int qt_metacall(QMetaObject::Call call, int id, void **arguments);
    bool connectDynamicSlot(QObject *object,
                            const char *signal,
                            const QString &slot);
    //bool connectDynamicSignal(int signalId, QObject *obj, const char *slot);
//    void emitSignal(int signalId, void **arguments);
private:
    bool containsSlot(const QString &name);
    QObject *m_mapTo;
    const char *m_catchMethod;
    typedef struct {
        QString name;
        QVector<int> parameterTypes;
    } slot_t;
    QVector<slot_t> m_slotList;
};

#endif // DYNAMICQOBJECT_H
